package com.hmall.trade.listener;

import com.hmall.common.constants.MqConstants;
import com.hmall.trade.service.IOrderService;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PaySuccessListener {
    @Autowired
    private IOrderService iOrderService;
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(MqConstants.PAY_SUCCESS_QUEUE),
        exchange = @Exchange(MqConstants.PAY_EXCHANGE_NAME),
        key = MqConstants.PAY_SUCCESS_KEY

))
    public void listenPaySuccess(Long orderId){

    iOrderService.markOrderPaySuccess(orderId);
    }
}
